package cn.flant.log;

import cn.flant.log.adapter.LoggerFactory;

public abstract class Logger {
	public static final int DEBUG = 1;
	public static final int INFO = 2;
	public static final int WARN = 3;
	public static final int ERROR = 4;
	public static final int FATAL = 5;

	private static int defaultLevel = DEBUG;

	public static int getDefaultLevel() {
		return defaultLevel;
	}

	public static void setDefaultLevel(int defaultLevel) {
		Logger.defaultLevel = defaultLevel;
	}

	public static Logger getLogger(String name) {
		return LoggerFactory.newLoggerAdapter(name);
	}

	public static Logger getLogger(Class<?> clazz) {
		return getLogger(clazz.getName());
	}

	protected int level = defaultLevel;

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public abstract void debug(Object msg);

	public abstract void debug(Object msg, Throwable t);

	public abstract void error(Object msg);

	public abstract void error(Object msg, Throwable t);

	public abstract void fatal(Object msg);

	public abstract void fatal(Object msg, Throwable t);

	public abstract void info(Object msg);

	public abstract void info(Object msg, Throwable t);

	public abstract void warn(Object msg);

	public abstract void warn(Object msg, Throwable t);
}
